|
|
|
|
|
|
|
When asking the user a question, you should keep the question short and simple. In the preceding code, MsgBox is used as a function call to retrieve the clicked button. You can see that Im comparing the value returned against the constant vbYes. Several constants are used to determine which button has been clicked in a MsgBox (see Table 11.3). |
|
|
|
|
| Table 11.3 Constants That Tell Which Button Was Clicked. | | Constant | Description | | vbAbort | The Abort button was clicked. | | vbCancel | The Cancel button was clicked. | | vbIgnore | The Ignore button was clicked. | | vbNo | The No button was clicked. | | vbOK | The OK button was clicked. | | vbRetry | The Retry button was clicked. | | vbYes | The Yes button was clicked. |
|
|
|
|
|
|
If you think the user might need more help with a particular dialog box, you should add a Help context ID and Help file to the parameters you pass to the MsgBox dialog box. To add the Help button to the MsgBox, use the following code: |
|
|
|
 |
|
|
|
|
Private Sub cmdHelp_Click()
MsgBox "A Critical Error Has Occurred", _
vbCritical + vbAbortRetryIgnore _
+ vbMsgBoxHelpButton, _
"Error", App.Path & "\MyHelp.hlp", 5
End Sub |
|
|
|
|
|
|
|
|
When you click the fourth command button in the form, youll see the message box shown in Figure 11.4. |
|
|
|
|
|
|
|
|
Figure 11.4
A message box with a Help button. |
|
|
|
|
|